#!/bin/bash

####################################
## Download rootfs.cpio.gz from $1
####################################

IP="192.168.0.101"
PORT=""
USER="test"
PWD="Test"
REMOTE_DIR="/autobuild/linux_kernel/$1"
LOC_DIR="./usr/"
FILES="rootfs.cpio.gz"

DownloadFile(){
    ftp -ivn << EOF
    open $IP $PORT
    user $USER $PWD
    binary
    cd $REMOTE_DIR
    lcd $LOC_DIR
    get $FILES
    close
    bye
EOF
}

echo "Download rootfs.cpio.gz from ftp://${IP}${REMOTE_DIR}."
DownloadFile
